import http from '@/utils/http'
import {
  systemDictAddType, systemDictAllListType,
  systemDictEditType, systemDictIdType,
  systemDictListItemType,
  systemDictListType
} from '@/type/system.dict'
import {
  systemDictValueAddType, systemDictValueIdType,
  systemDictValueListItemType,
  systemDictValueListType,
  systemDictValueUpdateType
} from '@/type/system.dictValue'

export const dictAdd = (data: systemDictAddType) => http.post("system/dict/add", data)

export const dictList = (data: systemDictListType) => http.post<{
  current: number,
  pageSize: number,
  total: number,
  list: systemDictListItemType[]
}>("system/dict/list", data)

export const dictEdit = (data: systemDictEditType) => http.put("system/dict/edit", data)

export const dictDelete = (data: systemDictIdType) => http.delete("system/dict/delete", data)

export const dictAllList = () => http.get<systemDictAllListType[]>("system/dict/allList")

export const dictValueAdd = (data: systemDictValueAddType) => http.post("system/dict/valueAdd", data)

export const dictValueList = (data: systemDictValueListType) => http.post<{
  list: systemDictValueListItemType[]
  current: number,
  pageSize: number,
  total: number
}>("system/dict/valueList", data)

export const dictValueEdit = (data: systemDictValueUpdateType) => http.put("system/dict/valueEdit", data)

export const dictValueDelete = (data: systemDictValueIdType) => http.delete("system/dict/valueDelete", data)
